home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1463 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: nntp.pinc.com!usenet
  2. From: MCOLYNUCK@PIM.BC.CA (Michael Colynuck)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What wrong with this code ??????
  5. Date: Sun, 14 Jan 1996 07:07:37 GMT
  6. Organization: Pacific InterConnect
  7. Message-ID: <4dagqd$g7q@nntp.pinc.com>
  8. References: <4bjl81$qiu@wumpus.cc.uow.edu.au> <JARNOT.96Jan9145744@box10.dstar.iddis.com>
  9. NNTP-Posting-Host: pinc102.pinc.com
  10. X-Newsreader: Forte Free Agent v0.55
  11.  
  12. jarnot@iddis.com (Kevin J. Jarnot) wrote:
  13.  
  14. >>>>>> "PAOPENG" == PAOPENG THEERADECH <tp86@wumpus.cc.uow.edu.au> writes:
  15.  
  16. >    PAOPENG> #include <stdio.h>
  17. >    PAOPENG> /* copy input to output */
  18. >    PAOPENG> main()
  19. >    PAOPENG> {
  20. >    PAOPENG>     int c;
  21. >    PAOPENG>     
  22. >    PAOPENG>     printf("\nPlease Enter the character: ");
  23. >    PAOPENG>     c =getchar();
  24. >    PAOPENG>     while (c != EOF)
  25. >    PAOPENG>     {
  26. >    PAOPENG>         putchar(c);
  27. >    PAOPENG>         c = getchar;
  28. >                                 ^^^^
  29. >    PAOPENG>     }
  30. >    PAOPENG> }
  31.  
  32. >    PAOPENG> Do anyone here know what wrong with this code?
  33.  
  34.  
  35.  
  36.  
  37. >I'm not sure if it was your problem, but you forgot the parens
  38. >afer getchar.
  39.  
  40.  
  41. >You should have an interesting value stored in c!  BTW, this is
  42. >valid C code, although you'll get a warning about mixing pointers
  43. >and integers.
  44.  
  45.  
  46.  
  47. >Kevin
  48.  
  49.  
  50.  
  51. Might be compiler dependant but shouldn't a the 'char' be an 'unsigned
  52. iint' ?
  53.  
  54. Michael
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. >-- 
  62. >Kevin J. Jarnot - Senior Software Engineer | mailto:jarnot@iddis.com 
  63. >IDD Information Services  Waltham, MA      | http://www-cs.canisius.edu/~jarnot
  64.  
  65.  
  66.